package org.logic.linguisticSummaries.type21summaries;

import org.logic.fuzzysets.AFuzzySet;
import org.logic.linguisticSummaries.ASummary;

public class SummaryTypeTwoOne extends ASummary{

	String subject1;
	String subject2;
	AFuzzySet quantifier;
	AFuzzySet summarizer;
	
	public SummaryTypeTwoOne(String subject1, String subject2, AFuzzySet quantifier, AFuzzySet summarizer) {
		this.subject1 = subject1;
		this.subject2 = subject2;
		this.quantifier = quantifier;
		this.summarizer = summarizer;
	}
	
	@Override
	public String generateSummary() {

		double upCardinalValue = summarizer.getCardinalValue() * (1/(double)summarizer.getUniverse().size());
		double downCardinalValue = summarizer.getQualifier().getCardinalValue() * (1/(double)summarizer.getQualifier().getUniverse().size());
				
		setDegreeOfTruth(quantifier.getMembershipFunction().getMembershipDegree(upCardinalValue/(downCardinalValue+upCardinalValue)));
		
		return quantifier.getLabel()+" "+subject1+" relatively to "+subject2+" "+ summarizer.getLabel()+". [T:"+getDegreeOfTruth()+"]";
	}
}
